!Dynamic Plugins

!!Benefits of dynamic plugins
   * Gives access to huge .NET and other libraries (afternoon "Plugin Development with Thirdparty SDKs")
   * Recursive algorithms (we could do an example together - fractals)
   * Custom datatypes (maybe outdated due to Message 2.0 and other contributions)
   * Asynchronous Programming (little walkthrough example)
     * Quickly react to async input data (mouse, keyboard, touch, network)
     * Outsource long running tasks (loading stuff from harddisk or network)
   * Parallel Programming (little walkthrough example)
     * Distribute certain heavy compuations to all cores

!!Essential C# attributes and interfaces
   * Attribute: PluginInfo
     Used to declare which classes should be made available as nodes inside of VVVV.
   * Interface: IPluginEvaluate (mandatory)
     Defines the entry point (Evaluate) which gets called by the plugin hosting code whenever data for one of the outputs is requested.
   * Interface: IPartImportsSatisfiedNotification (optional)
     Defines the entry point (OnImportsSatisfied) which gets called when the pins have been created.
   * Interface: IDisposable (optional)
     Defines the entry point (Dispose) which gets called when the plugin gets deleted.
   * Attribute: Input, Output and Config
     Used to declare which fields of the class should be made available as pins in VVVV. 
   * Interface: ISpread<T>
     Provides a random access view on the in- and output pins.
     
!!Who is calling what and when
  1) Constructor of class (after the node as been created)
     Initialize fields which are outside the VVVV world.
  2) OnImportsSatisfied (after the pins have been created)
     Initialize pins, subscribe to events of VVVV etc.
  3) Evaluate (at most once per frame or every frame if the AutoEvaluate flag is set)
     Iterate the inputs, do some computation, write to the outputs.
  4) Dispose (when the node gets deleted)
     Unsubsribe from events and dispose fields which were created in the constructor.
     
!!Tips and tricks
   * ISpread<T> : IEnumerable<T> - central interface in the C# world!
   * Watch out for spreads with a slice count of 0!
   * Never ever write something like: 
       MyOutputSpread = someOtherSpread;
     You lose the view on the output pin. Instead write:
       MyOutputSpread.AssignFrom(someOtherSpread);
   * Do not access the in- and output spreads from any other thread than the one calling Evaluate!
   
!!Little hands-on example
  Take one example from http://natureofcode.com/book/chapter-8-fractals/ ?
  * Clone from template
  * Incorporate code from book into the plugin
  * Add some pins to control depth of recursion and other parameters of alogrithm

!!Walkthrough of asynchronous programming example

!!Walkgrough of parallel programming example